Launch respawn node
Table of Content
LAB#
- Ros restart process and file or exit
Demo#
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
ld = LaunchDescription()
sim_node = Node(
package='turtlesim',
namespace='turtlesim1',
executable='turtlesim_node',
name='sim',
respawn=True,
respawn_delay=4
)
ld.add_action(sim_node)
return ld
You can run launch file without the package relation
ros2 launch <launch file>
usage#
ros2 launch launch_node_respawn.launch.py
- Close the window
- After 4 sec ROS2 launch the node